package com.example.hanfu.tiku;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

import androidx.annotation.Nullable;

public class DatiDBHelper extends SQLiteOpenHelper {
    private static final int VERSION = 1;
    private static final String DB_NAME = "Question.db";
    private static final String TAG = "DBHelperTiku";
    public static final String TB_NAME = "question";
    public DatiDBHelper(@Nullable Context context) {
        super(context, DB_NAME, null, VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("CREATE TABLE "+TB_NAME+" (id INTEGER PRIMARY KEY AUTOINCREMENT,topic TEXT,option_a TEXT,option_b TEXT,option_c TEXT,option_d TEXT,answer INTEGER,corAnswer TEXT)");
        Log.i(TAG,"创建数据库");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
